<%--
 *  @Author: Kevinfan
 *  Date:    2010/12/23
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.ProdInfo");
  String strModuleName = "ERM";
  String privilegeCode = "10340,10341";
  String contextPath = request.getContextPath();
  HashMap userinfo = (HashMap)session.getAttribute("userinfo");
%>
<% //--------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%int LangNums = ConstantProp.multiLangNumber;%>
<html>
<head>
<title>DoctorEdit</title>
<PageFlow:CheckPageFlow pageName="p_zyldoctorprodinfo"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>
<script language="JavaScript">

function page_back(){
	parent.location.href="DoctorSummary.jsp?<%= OvalTools.randomURL()%>";
}

function page_add()
{
  if(!checkALLElems(document.getElementById("newdetail"))) return;
  cform.actionname.value = "add";
  cform.target = "_self";
  //isRunning = true;
  __submitData("pageform",true);
}

function page_delete()
{
  if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  if(!confirm('<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>'))
     return;
  cform.actionname.value = "delete";
  cform.target = "_self";
  //isRunning = true;
  __submitData("pageform",true);
}

function page_selectProd() {
		var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%=contextPath %>/phap/phap.datp/masterdata/kdm/ProductSelect.jsp?<%= OvalTools.randomURL() %>";
		if (typeof popwindow1 != 'undefined') popwindow1.close();
		popwindow1 = window.open(url, "newwindow1", status);
}

function page_selectCheckbox(flag,dicvalues){
		var status = "height=400, width=300,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		if(flag == 'view'){
			url = "<%=contextPath %>/zyl/masterdata/erm/SelectCheckbox.jsp?<%= OvalTools.randomURL() %>&dicvalues=" + dicvalues + "&flag=1";
		}else{
			url = "<%=contextPath %>/zyl/masterdata/erm/SelectCheckbox.jsp?<%= OvalTools.randomURL() %>&dictype=Reason&flag=1";
		}
		if (typeof popwindow1 != 'undefined') popwindow1.close();
		popwindow1 = window.open(url, "newwindow1", status);
}

function page_setproduct(id,umcode,prodcode,prodname)
{	
    document.cform.prodid.value = id;
    document.cform.prodcode.value=prodcode;
    document.cform.prodname.value=prodname;
}

function page_setStr(str)
{	
    document.cform.reason.value = str;
}

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}
</script>
</head>
<%
String strDisplayFlag="";
if(request.getParameter("displayflag")!=null)
{
  strDisplayFlag=request.getParameter("displayflag");
}
%>
<iframe name="reloadHandler" style="display:none" ></iframe>
<body>
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
</table>
<table width="2400" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">
  <form id="pageform" name="cform" method="post" action="/oval/Dispatcher" >
  <input type="hidden" name="pagename" value="p_zyldoctorprodinfo">
  <input type="hidden" name="actionname">
  <input type="hidden" name="doctorid" value="<%=pageContext.getAttribute("doctorid")%>">
		<tr class="deepblue-left"> 
		  	<td width="2%" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="page_allcheckselect();"></td>
          	<td width="3%" class="title_center"><%= label.getLabelName("L_ProductCode") %></td>
          	<td width="5%" class="title_center"><%= label.getLabelName("L_ProductName") %></td>
	  		<!-- 
	  		<td class="title_center"><%= label.getLabelName("L_level") %></td>
			<td class="title_center"><%= label.getLabelName("L_BuyCycle") %></td>
	  		 -->
			<td class="title_center"><%= label.getLabelName("L_Drugnum") %></td>
			<td class="title_center"><%= label.getLabelName("L_Singledruglevel") %></td>
			<!--<td class="title_center"><%= label.getLabelName("L_Multydruglevel") %></td>-->
			<td class="title_center"><%= label.getLabelName("L_Drugrate") %></td>
			<td class="title_center"><%= label.getLabelName("L_Drugphase") %></td>
	  		<td class="title_center"><%= label.getLabelName("L_ComplaintReason") %></td>
			<td class="title_center"><%= label.getLabelName("L_Potential") %></td>
			<td class="title_center"><%= label.getLabelName("L_BPotentialitylevel") %></td>
			<td class="title_center"><%= label.getLabelName("L_DoctorTargetLevel") %></td>
	  		<td class="title_center"><%= label.getLabelName("L_DevelopDegree") %></td>
			<td class="title_center"><%= label.getLabelName("L_VisitWay") %></td>
	  		<td class="title_center"><%= label.getLabelName("L_Influence") %></td>
			<td class="title_center"><%= label.getLabelName("L_TeamworkDegree") %></td>
			<td class="title_center"><%= label.getLabelName("L_Relatedconsulting") %></td>
			<td class="title_center"><%= label.getLabelName("L_Relatedsickbed") %></td>
			<td class="title_center"><%= label.getLabelName("L_Bedturnovernum") %></td>
			<td class="title_center"><%= label.getLabelName("L_RelatedPatientNum") %></td>
			<td class="title_center"><%= label.getLabelName("L_Filedate") %></td>
			<td class="title_center"><%= label.getLabelName("L_DevelopDate") %></td>
			<td class="title_center"><%= label.getLabelName("L_Thirdprodinfo") %></td>
	  	</tr>
      	  <%
            Vector doctorprodinfo=(Vector)pageContext.getAttribute("doctorprodinfo");
            if(doctorprodinfo==null)
              doctorprodinfo=new Vector();
            int i=1;
            int org =0;;
            String strClassType="none";
          %>
          <logic:iterate id="doctorprodinfoitem" collection="<%= doctorprodinfo %>" >
          <%
          	HashMap PSMap = (HashMap)pageContext.getAttribute("doctorprodinfoitem");
            Integer oColIndexLang=new Integer(i);
            if(i%2==0)
              strClassType="td-listrom";
            else
              strClassType="none";
            i++;
          %>
         <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"  class="<%=JspHelper.filterNull(strClassType)%>"> 
            <td class="td_center"> 
              	<input type="checkbox" name="deleteids" id="deleteids<%=JspHelper.filterNull(i-1)%>" value="<custom:write name="doctorprodinfoitem" property="doctorprodid"/>" class="normalradio" />
            </td>
            <td class="td_center"><custom:write name="doctorprodinfoitem" property="prodcode" nbsp="true"/></td>
            <td class="td_center"><custom:write name="doctorprodinfoitem" property="prodname" nbsp="true"/></td>
            <!-- 
            <td class="td_center"><custom:write name="doctorprodinfoitem" property="valuename" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="Level" name="doctorprodinfoitem" property="purchasecycle" nbsp="true"/></td>
             -->
           	
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="drugnum" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="Level" name="doctorprodinfoitem" property="singledruglevel" nbsp="true"/></td>
           	<!--<td class="td_center"><custom:write dictType="Level" name="doctorprodinfoitem" property="multydruglevel" nbsp="true"/></td>-->
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="drugrate" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="PrescriptionStage" name="doctorprodinfoitem" property="drugphase" nbsp="true"/></td>
           	<td class="td_center"><a href="javascript:page_selectCheckbox('view','<custom:write name="doctorprodinfoitem" property="reason" nbsp="true"/>')"><img src="<%=contextPath %>/images/<%= strLanguageCode %>/ss.png" border="0" ></a></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="potentiality" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="Level" name="doctorprodinfoitem" property="potentialitylevel" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="Level" name="doctorprodinfoitem" property="targetlevel" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="DevelopmentDegree" name="doctorprodinfoitem" property="devlevel" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="visitway" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="Influence" name="doctorprodinfoitem" property="influence" nbsp="true"/></td>
           	<td class="td_center"><custom:write dictType="CooperationDegrees" name="doctorprodinfoitem" property="cooperationlevel" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="relatedconsulting" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="relatedsickbed" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="bedturnovernum" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="relatedpatient" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="filedate" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="developdate" nbsp="true"/></td>
           	<td class="td_center"><custom:write name="doctorprodinfoitem" property="thirdprodinfo" nbsp="true"/></td>
          </tr>
          </logic:iterate>
          </span>
          <input type="hidden" name="nums" value="<%=JspHelper.filterNull(doctorprodinfo.size())%>">
          <input type="hidden" name="numrows" value="<%=LangNums*(JspHelper.filterNull(doctorprodinfo.size())+1)%>">
          <span id="newdetail">
          <tr class="none"> 
          	<td>&nbsp;</td>          
            <td colspan="2">
            	<custom:text property="prodcode" size="10"/>
            	<a onclick="javascript:page_selectProd();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="prodname" size="10" label="L_Products" command="notnull"/>
            	<custom:hidden property="prodid"/>
            </td>
            <!-- 
            <td>
            	<custom:selectdic dictType="DoctorProdLevel" property="prodlevel"  label="L_level"/>
           	</td>
			<td class="td_center"><custom:text property="purchasecycle" size="10" label="L_BuyCycle"/></td>
             -->
            
			<td class="td_center"><custom:text property="drugnum" size="10" label="L_Drugnum"/></td>
			<td class="td_center"><custom:selectdic dictType="Level" property="singledruglevel" label="L_Singledruglevel"/></td>
			<!--<td class="td_center"><custom:selectdic dictType="Level"  property="multydruglevel" label="L_Multydruglevel"/></td>-->
			<td class="td_center"><custom:text property="drugrate" size="10" label="L_Drugrate"/></td>
			<td class="td_center"><custom:selectdic dictType="PrescriptionStage"  property="drugphase" label="L_Drugphase"/></td>
	  		<td class="td_center"><custom:text property="reason" label="L_ComplaintReason"/>
	  			<a onclick="javascript:page_selectCheckbox('add');"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
	  		</td>
			<td class="td_center"><custom:text property="potentiality" size="10" label="L_Potential"/></td>
	  		<td class="td_center"><custom:selectdic dictType="Level"  property="potentialitylevel" label="L_BPotentialitylevel"/></td>
	  		<td class="td_center"><custom:selectdic dictType="Level"  property="targetlevel" label="L_DoctorTargetLevel"/></td>
	  		<td class="td_center"><custom:selectdic dictType="DevelopmentDegree"  property="devlevel" label="L_DevelopDegree"/></td>
			<td class="td_center"><custom:text property="visitway" size="10"  label="L_VisitWay"/></td>
	  		<td class="td_center"><custom:selectdic dictType="Influence" property="influence" label="L_Influence"/></td>
			<td class="td_center"><custom:selectdic dictType="CooperationDegrees"  property="cooperationlevel" label="L_TeamworkDegree"/></td>
			<td class="td_center"><custom:text property="relatedconsulting" size="10" command="notnegative" dataType="number" label="L_Relatedconsulting"/></td>
			<td class="td_center"><custom:text property="relatedsickbed" size="10" command="notnegative" dataType="number" label="L_Relatedsickbed"/></td>
			<td class="td_center"><custom:text property="bedturnovernum" size="10" command="notnegative" dataType="number" label="L_Bedturnovernum"/></td>
			<td class="td_center"><custom:text property="relatedpatient" command="notnegative" size="10" dataType="number" label="L_RelatedPatientNum"/></td>
			<td class="td_center">
			 <custom:text property="filedate" dataType="date" name="doctorinfo" dataFormatName="dateformat" size="20"  label="L_Filedate" onfocus="c.show(this,'cform.filedate','yyyy-MM-dd')" />
			</td>
			<td class="td_center">
			<custom:text property="developdate" dataType="date" name="doctorinfo" dataFormatName="dateformat" size="20"  label="L_DevelopDate" onfocus="c.show(this,'cform.developdate','yyyy-MM-dd')" />
			</td>
			<td class="td_center"><custom:text property="thirdprodinfo" size="30" label="L_Thirdprodinfo"/></td>
          </tr>
          </span>
		<tr>
			<td class="summary_top"></td>
		</tr>
  </form>
</table>
	<%if(!(strDisplayFlag).equals("view")){%>
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr>
			<td class="td_center">
			<a onclick="javascript:page_add();"><custom:button type="2" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
			<a onclick="javascript:page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
			<a onclick="__back()"><custom:button type="2" label="L_Back" imgsrc="delete.gif" border="0" style="width:60"/></a>
			</td>
		</tr>
	</table>
	<%} %>
</body>
<script>
  var list=document.getElementsByTagName("input");
  m=list.length;
  list[m-1].style.display='none';
</script>
</html>